<%--
  Created by IntelliJ IDEA.
  User: glxyC113
  Date: 2021/11/5
  Time: 9:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>
<head>
    <title>药品管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="<%=basePath%>css/style.css" rel="stylesheet" type="text/css" />
    <link href="<%=basePath%>css/select.css" rel="stylesheet" type="text/css" />
    <link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="<%=basePath%>js/jquery.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/select-ui.min.js"></script>
    <script type="text/javascript">

        function deletes(id){
            if (confirm("您确定要删除此用户的信息吗？")) {
                window.location.href = "<%=basePath%>deleteDrugsController?id="+id;
            }
        }

        function modify(id){
            if (confirm("您确定要修改此用户的信息吗？")) {
                window.location.href = "<%=basePath%>drugsPriceController?id="+id;
            }
        }

        function cz(id){
            if (confirm("您确定要修改此药品的库存数量吗？")) {
                window.location.href = "<%=basePath%>drugsnumController?id="+id;
            }
        }
        $(function(){
            $('tbody tr:odd').addClass("trLight");

            $(".select-all").click(function(){
                if($(this).attr("checked")){
                    $(".checkBox input[type=checkbox]").each(function(){
                        $(this).attr("checked", true);
                    });
                }else{
                    $(".checkBox input[type=checkbox]").each(function(){
                        $(this).attr("checked", false);
                    });
                }
            });

        });
    </script>
    <style type="text/css">
        body {
            background:#FFF
        }
    </style>
</head>
<body>
<div id="contentWrap">
    <!--表格控件 -->
    <form action="<%=basePath%>drugsListController" method="post" name="form1">
    <div id="widget table-widget">
        <div class="pageTitle">药品管理</div>
        <div class="querybody">
            <ul class="seachform">
                <li><label>药品ID</label><input name="drugsid" type="text" class="scinput" /></li>
                <li><label>药品名称</label><input name="name" type="text" class="scinput" /></li>
                <li><label>&nbsp;</label><input name="" type="submit" class="scbtn" value="查询"/></li>
            </ul>
        </div>
        <div class="pageColumn">
            <div class="pageButton"><a href="<%=basePath%>drugs/ypadd.jsp"><img src="<%=basePath%>images/t01.png" title="新增"/></a><span>药品列表</span></div>
            <table>
                <thead>
                <th width="">药品ID</th>
                <th width="">药品名称</th>
                <th width="">进价</th>
                <th width="">售价</th>
                <th width="">库存数量</th>
                <th width="">引入日期</th>
                <th width="">生产厂商</th>
                <th width="">生产日期</th>
                <th width="">保质期</th>
                <th width="">供货单位</th>
                <th width="10%">库存新增</th>
                <th width="10%">操作</th>
                </thead>
                <tbody>
                <c:forEach items="${pageInfo.list}" var="drugs" >
                    <tr>
                        <td>${drugs.drugsid}</td>
                        <td>${drugs.name}</td>
                        <td>${drugs.price}</td>
                        <td>${drugs.purchaseprice}</td>
                        <td>${drugs.num}</td>
                        <td>
                            <fmt:formatDate value="${drugs.introducedate}" pattern="yyyy-MM-dd"/>
                        </td>
                        <td>${drugs.productunit}</td>
                        <td>
                            <fmt:formatDate value="${drugs.productdate}" pattern="yyyy-MM-dd"/>
                        </td>
                        <td>
                            <fmt:formatDate value="${drugs.qualityperiod}" pattern="yyyy-MM-dd"/>
                        </td>
                        <td>${drugs.supplyunit}</td>
                        <td>
                            <a onclick="modify(${drugs.drugsid})"><img src="<%=basePath%>images/icon/edit.png" width="16" height="16" /></a>
                            <a onclick="deletes(${drugs.drugsid})"><img src="<%=basePath%>images/icon/del.png" width="16" height="16" /></a>
                        </td>
                        <td>
                            <a onclick="cz(${drugs.drugsid})"><img src="<%=basePath%>images/icon/edit2.png" width="16" height="16" /></a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div><!-- #widget -->
    <div id="pagination" style="align:right;margin-top:-10px;">
        <div id='project_pagination' class="pagination pagination-centered">
            <div class="pagination">
                <ul>
                    <li class="disabled"><a href="#">«</a></li>
                    <li class="active"><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">4</a></li>
                    <li><a href="#">»</a></li>
                </ul>
            </div>
        </div>
    </div>
    </form>
</div>
</body>
</html>
